<?php
declare (strict_types = 1);

namespace app\admin\controller;
use app\admin\model\GoodsPropValue;
use think\facade\Db;
use think\facade\Request;
use think\facade\View;
class ShuXing
{
    public function ShuXing()
    {
        $keywords = Request::get('keywords', '', 'trim,htmlspecialchars,strip_tags');
        $pvalues = Request::get('pvalues', '200', 'trim,htmlspecialchars,strip_tags');
        $data = [
            'keywords' => $keywords,
            'pvalues' => $pvalues,
        ];
        $page=\think\facade\Config::has('view.list_rows')?\think\facade\Config::get('view.list_rows'):15;
        $rt = \app\admin\model\GoodsProp::GoodsProp($data, $page, input('get.'));
        $tlist = \app\admin\model\GoodsProp::text();



        View::assign($data);
        View::assign('glist', $rt);
        View::assign('keywords', $keywords);
        View::assign('tlist', $tlist);
        View::assign('pvalues', $pvalues);
        return View::fetch();
    }
}
//        if ($keywords!=''){
//            $where.=" and pname like '%$keywords%'";
//        }
//        $a=Db::table('ecm_goods_prop')->where($where);
//        if (!empty($vid)){
//            foreach ($vid as $k=>$v){
//                $a->whereFindInSet('pvalues',$v);
//            }
//
//        }
//
//       $rt=$a->paginate([
//           'list_rows'=>1,
//           'query'=>Request::get(),
//       ])->each(function($v,$k){
//           $shuxing=Db::table('ecm_goods_prop_value')->field('pid,prop_value')->where("vid in ({$v['pvalues']})")->select();
//           $arr=[];
//           foreach($shuxing as $kk=>$vv){
//               $arr[]=$vv['prop_value'];
//               $a=implode(',',$arr);
//           }
//           $v['a']=$a;
//           View::assign('arr',$arr);
//           return $v;
//       });



//        $result = Db::table('ecm_goods_prop')
//            ->field(true)
//            ->where('pvalues','find in set','5')
////            ->whereFindInSet('pvalues','5')
//            ->select();
//        echo "<pre>";
//        print_r($result);
//        echo "</pre>";
//        $page = $rt->render();
//        View::assign('page',$page);
//
//    }


